package com.yuji.aacar.tools;

import android.content.Context;
import android.content.Intent;

import com.yuji.aacar.bean.beans.BasicMessage;
import com.yuji.aacar.bean.beans.OrderMessage;

import java.util.Map;

public class UmessageHandler {
    private BasicMessage basicMessage;
    public static final String ORDER_DETAIL = "R01";//订单详情
    private Context mContext;

    public UmessageHandler() {

    }

    public void createMessage(Map<String, String> map) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String orderno = entry.getValue();

            basicMessage = new OrderMessage(orderno);

//            if ("orderno".equals(key)) {
//                switch (value) {
//                    case ORDER_DETAIL:
//                        basicMessage = new Reviews(Integer.parseInt(map.get("id")));
//                        break;
////                    case VERSION_CODE:
////                        basicMessage = new PushVersion(map.get("downUrl"), map.get("version"), map.get("level"), map.get("interfaceURL"));
////                        VersionJson versionJson = new VersionJson();
////                        versionJson.setDownloadUrl(map.get("downUrl"));
////                        versionJson.setVersion(map.get("version"));
////                        versionJson.setInterfaceURL(map.get("interfaceURL"));
////                        versionJson.setSuggestionLevel(Integer.parseInt(map.get("level")));
////                        CoreEventBusMessage message = new CoreEventBusMessage(VERSION_CODE);
////                        message.setMessageObjects(versionJson);
////                        CoreEventCenter.post(message);
////                        CorePersistenceUtil.saveObject("versionJson", versionJson);
////                        break;
//                }
//            }
        }

    }

    public void handMsg() {
        basicMessage.dispose();
    }

    public Intent getIntent() {
        return basicMessage.click();
    }

}
